<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('维保记录列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>维保类型：</label>
                            <select name="type" th:with="type=${@dict.getType('vehicle_maintenance')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <input type="hidden" name="equipmentInfoId" th:value="*{equit.equipmentInfoId}"  visibility="hidden"/>
                        </li>
                        <li>
                            <label>创建人：</label>
                            <input type="text" name="createName"/>
                        </li>
                        <li>
                            <label>经手人：</label>
                            <input type="text" name="handlers"/>
                        </li>
                        <li>
                            <label>维保厂家：</label>
                            <input type="text" name="maintenanceFactory"/>
                        </li>
                        <li>
                            <label>制单人：</label>
                            <input type="text" name="billMaker"/>
                        </li>
                        <li>
                            <label>审核人：</label>
                            <input type="text" name="reviewPerson"/>
                        </li>
                        <li>
                            <label>审核状态：</label>
                            <select name="reviewState" th:with="type=${@dict.getType('approve_state')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>制单日期：</label>
                            <input type="text" class="time-input" id="startTimeBill" placeholder="开始时间"
                                   name="params[beginBillDate]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTimeBill" placeholder="结束时间"
                                   name="params[endBillDate]"/>
                        </li>
                        <li class="select-time">
                            <label>维保开始时间：</label>
                            <input type="text" class="time-input" id="startTimeBegin" placeholder="开始时间"
                                   name="params[beginMaintenanceSDate]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTimeBegin" placeholder="结束时间"
                                   name="params[endMaintenanceSDate]"/>
                        </li>
                        <li class="select-time">
                            <label>维保结束时间：</label>
                            <input type="text" class="time-input" id="startTimeEnd" placeholder="开始时间"
                                   name="params[beginMaintenanceEDate]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTimeEnd" placeholder="结束时间"
                                   name="params[endMaintenanceEDate]"/>
                        </li>
                        <li class="select-time">
                            <label>审核时间：</label>
                            <input type="text" class="time-input" id="startTimeApprove" placeholder="开始时间"
                                   name="params[beginReviewTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTimeApprove" placeholder="结束时间"
                                   name="params[endReviewTime]"/>
                        </li>
                        <li class="select-time">
                            <label>提交时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginCdt]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endCdt]"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:maintenance:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "system/maintenance";

    $(function () {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            modalName: "维保记录",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'equipmentInfoId',
                    title: '设备id',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var equipmentInfoId=row.equipmentInfoId;
                        actions.push('<a class="btn btn-primary btn-xs ' + '" href="javascript:void(0)" onclick="goDetail(\'' + row.id +'\',\''+row.equipmentInfoId+ '\')">'+equipmentInfoId+'</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'cost',
                    title: '总金额(元)'
                },
                {
                    field: 'maintenanceFactory',
                    title: '维保厂家'
                },
                {
                    field: 'maintenanceSDate',
                    title: '维保开始时间'
                },
                {
                    field: 'maintenanceEDate',
                    title: '维保结束时间'
                },
                {
                    field: 'handlers',
                    title: '经手人'
                },
                {
                    field: 'billMaker',
                    title: '制单人'
                },
                {
                    field: 'billDate',
                    title: '制单日期'
                },
                {
                    field: 'projectname',
                    title: '项目名'
                },
                {
                    field: 'reviewPerson',
                    title: '审核人'
                },
                {
                    field: 'reviewState',
                    title: '审核状态'
                },
                {
                    field: 'reviewTime',
                    title: '审核时间'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'createrName',
                    title: '创建人'
                },
                {
                    field: 'cdt',
                    title: '创建时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="goDetail(\'' + row.id +'\',\''+row.equipmentInfoId+ '\')" style="padding:4px; margin:4px"><i class="fa fa-edit"></i>查看详情</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function goDetail(mid,carno) {
        var url = ctx + 'system/maintenancedetail/justdetail/list/'+mid+'?carno='+carno;
        $.modal.open("设备维保详情", url, '820', '600');
    }

</script>
</body>
</html>